package lyl.math;

import java.util.Locale;
import java.text.NumberFormat;
import java.text.ParseException;

public class ParseFormat {

	public static void main(String args[]) {

		// 本地格式的解析
		NumberFormat numberFormat1 = NumberFormat.getNumberInstance();
		Number numb1 = null;
		try {
			numb1 = numberFormat1.parse("33,333.33");
		} catch (ParseException e1) {
			System.err.println(e1);
		}
		System.out.println(numb1);

		// 以德国格式解析
		NumberFormat numberFormat2 = NumberFormat
				.getNumberInstance(Locale.GERMAN);
		Number numb2 = null;
		try {
			numb2 = numberFormat2.parse("33,333.33");
		} catch (ParseException e2) {
			System.err.println(e2);
		}
		System.out.println(numb2);

		System.exit(0);
	}
}